/**
 * Created by Administrator on 2017/5/12.
 */
/**
 * 帧工具类:获取每秒的真实的fps和总fps
 * */
(
    function (){
        window.FrameUtil = Class.extend({
            init: function(option){
                this.option = option ||{};
                //获取当前时间
                this.stime = new Date();
                //设置起始的帧数
                this.sFrame = 0;
                //设置当前的帧数
                this.currentFrame = 0;
                //设置真实的fps
                this.reaFps = 0;
            },

            render : function(){
                //记录当前的帧数
                this.currentFrame++;

                 //记录当前的时间
                var currentTime = new Date();

                //判断每秒钟走的真实fps
                if(currentTime - this.stime >= 1000){
                    this.reaFps = this.currentFrame - this.sFrame;
                    //更新起始时间
                    this.stime = new Date();
                    //更新起始帧数
                    this.sFrame = this.currentFrame;
                }
        },


        })
    }
)()